package com.xnx3.wangmarket.plugin.order.controller;

import java.awt.Font;
import java.io.IOException;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.xnx3.StringUtil;
import com.xnx3.j2ee.Func;
import com.xnx3.j2ee.controller.BaseController;
import com.xnx3.j2ee.entity.User;
import com.xnx3.j2ee.service.SqlService;
import com.xnx3.j2ee.service.UserService;
import com.xnx3.j2ee.shiro.ShiroFunc;
import com.xnx3.j2ee.util.ActionLogUtil;
import com.xnx3.j2ee.util.ApplicationPropertiesUtil;
import com.xnx3.j2ee.util.SystemUtil;
import com.xnx3.j2ee.vo.BaseVO;
import com.xnx3.j2ee.vo.LoginVO;
import com.xnx3.kefu.core.Global;
import com.xnx3.kefu.core.entity.Kefu;
import com.xnx3.kefu.core.entity.Zuoxi;
import com.xnx3.kefu.core.util.SessionUtil;

import cn.zvo.http.Http;
import cn.zvo.http.Response;

/**
 * kefu.js 客服插件配合的demo接口
 * @author 管雷鸣
 */
@Controller(value="OrderPluginDemoController")
@RequestMapping("/plugin/order/")
public class DemoController extends BaseController {

	/**
	 * 当咨询者点击聊天输入框下的“订单” 按钮时，会通过这个接口获取这个咨询者的订单列表
	 */
	@RequestMapping(value="orderList.json", method = RequestMethod.POST)
	@ResponseBody
	public String orderList(HttpServletRequest request) throws IOException{
		if(orderListJson == null) {
			Http http = new Http();
			Response res = http.get("https://gitee.com/mail_osc/kefu.js/raw/main/extend/order/orderList.json");
			if(res.getCode() == 200) {
				orderListJson = res.getContent();
			}
		}
		return orderListJson;
	}
	private static String orderListJson = null;
	
}
